<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>方案对应的运动员</title>
    <link rel="stylesheet" href="../../res/layui/css/layui.css" media="all">
    <script src="../../res/js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../res/layui/layui.js"></script>
</head>
<body>

<table class="layui-hide" id="test" lay-filter="test"></table>
<script type="text/javascript" charset="utf-8">
    layui.use('table', function(){
        console.info(data);
        var table = layui.table;
        table.render({
            elem: '#test'
            ,url:'../../mentalityAthlete/selectAllAthlete'
            ,page: true //开启分页
            ,toolbar: '#toolbarDemo'
            , id: 'testReload'
            ,title: '方案对应的运动员'
            ,cols: [[
                {field:'schemeName', title:'方案名称'}
                ,{field:'athleteName', title:'运动员姓名'}
                ,{field:'exp', title:'建议'}
                ,{field:'isRead', title:'是否查看' ,sort: true}
                ,{field:'readTime', title:'查看时间' ,sort: true}
                ,{fixed:'right', title:'操作', toolbar: '#barDemo', width:320}
            ]]
        });
        /* 头部工具栏监听 */
        /*table.on('toolbar(test)', function(obj){
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data; //获取选中的数据
            switch(obj.event){
                case 'search':

                    break;
            };
        });*/
        $(function(){
            $('#search').on('click',function(){
                console.info($("#schemeName").val());
                //执行重载
                table.reload('testReload',{
                    url:'../../mentalityAthlete/selectAllAthlete',
                    page: {
                        curr: 1 //重新从第 1 页开始
                    }
                    ,where: {
                        schemeName: $("#schemeName").val()
                    }
                });

            })
        })
    });
</script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-input-inline" style="float:left;margin-left:15px;">
        <input type="text" placeholder="请输入方案名" id="schemeName" class="layui-input" style="width:200px;float:left;height:32px;">
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="search" id="search" style="margin-left: 10px;">搜索</button>
    </div>
</script>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="look">查看</a>
</script>
</body>
</html>